Rebuild the dashboard with umi/max v4 and antd pro#782
Closed
dodo920306 wants to merge 39 commits into
Closed
Conversation
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
The page is provided by umi/max as an example. Signed-off-by: dodo920306 <dodo920306@gmail.com>
The service is provided by umi/max as an example. Signed-off-by: dodo920306 <dodo920306@gmail.com>
The util is provided by umi/max as an example. Signed-off-by: dodo920306 <dodo920306@gmail.com>
The constant is provided by umi/max as an example. Signed-off-by: dodo920306 <dodo920306@gmail.com>
The model is provided by umi/max as an example. Signed-off-by: dodo920306 <dodo920306@gmail.com>
Use 'menu.home' to allow i18n on the tab title of the home page. Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
Since onPageChange won't re-acquire the initial state, it failed to recognize a login user with refeshing the whole page. The solution is always allowing login users to enter inside with reponse interceptors to alert users with invalid tokens to login again. Signed-off-by: dodo920306 <dodo920306@gmail.com>
The interceptor is only used to intercept invalid tokens not wrong login attempts. Signed-off-by: dodo920306 <dodo920306@gmail.com>
Signed-off-by: dodo920306 <dodo920306@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new src/dashboard2 frontend, rebuilding the dashboard on Umi Max v4 + Ant Design Pro to address dependency upgrade work in #773.
Changes:
- Added a new Umi Max v4 project (
dashboard2) with its own tooling (Yarn, lint-staged, Prettier, ESLint/Stylelint) and Umi runtime config. - Implemented initial authenticated pages (Home, Login/Register, Organization/Node/Channel/Chaincode) using ProComponents tables/forms.
- Added typed service clients for the API engine endpoints and initial i18n strings (
en-US,zh-CN).
Reviewed changes
Copilot reviewed 40 out of 55 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dashboard2/typings.d.ts | Adds Umi Max typings import for the new dashboard. |
| src/dashboard2/tsconfig.json | TS config extending Umi-generated config. |
| src/dashboard2/src/utils/.gitkeep | Keeps utils directory in VCS. |
| src/dashboard2/src/services/user/UserController.ts | Adds user profile request service. |
| src/dashboard2/src/services/user/typings.d.ts | Defines user API types. |
| src/dashboard2/src/services/typings.d.ts | Defines shared API response typings. |
| src/dashboard2/src/services/organization/typings.d.ts | Defines organization API types. |
| src/dashboard2/src/services/organization/OrganizationController.ts | Adds organization list request service. |
| src/dashboard2/src/services/node/typings.d.ts | Defines node API types. |
| src/dashboard2/src/services/node/NodeController.ts | Adds node list/create request services. |
| src/dashboard2/src/services/channel/typings.d.ts | Defines channel API types. |
| src/dashboard2/src/services/channel/ChannelController.ts | Adds channel list/create request services. |
| src/dashboard2/src/services/chaincode/typings.d.ts | Defines chaincode API types. |
| src/dashboard2/src/services/chaincode/ChaincodeController.ts | Adds chaincode list/create + action request services. |
| src/dashboard2/src/services/auth/typings.d.ts | Defines auth token response types. |
| src/dashboard2/src/services/auth/AuthController.ts | Adds login/register request services. |
| src/dashboard2/src/pages/Organization/index.tsx | Organization list page (ProTable). |
| src/dashboard2/src/pages/Organization/index.less | Organization page styling. |
| src/dashboard2/src/pages/Node/index.tsx | Node list page with create modal. |
| src/dashboard2/src/pages/Node/index.less | Node page styling. |
| src/dashboard2/src/pages/Node/components/CreateForm.tsx | Node creation modal form. |
| src/dashboard2/src/pages/Login/index.tsx | Login/register page with validation and messaging. |
| src/dashboard2/src/pages/Home/index.tsx | Home/welcome page. |
| src/dashboard2/src/pages/Home/index.less | Home page styling. |
| src/dashboard2/src/pages/Channel/index.tsx | Channel list page with create modal. |
| src/dashboard2/src/pages/Channel/index.less | Channel page styling. |
| src/dashboard2/src/pages/Channel/components/CreateForm.tsx | Channel creation modal form. |
| src/dashboard2/src/pages/Chaincode/index.tsx | Chaincode list page with actions + create modal. |
| src/dashboard2/src/pages/Chaincode/index.less | Chaincode page styling. |
| src/dashboard2/src/pages/Chaincode/Components/CreateForm.tsx | Chaincode creation modal form (multipart + channel selection). |
| src/dashboard2/src/models/.gitkeep | Keeps models directory in VCS. |
| src/dashboard2/src/locales/zh-CN.ts | Chinese locale strings for new UI. |
| src/dashboard2/src/locales/en-US.ts | English locale strings for new UI. |
| src/dashboard2/src/global.less | Global styling overrides for Ant Design Pro layout/forms. |
| src/dashboard2/src/constants/.gitkeep | Keeps constants directory in VCS. |
| src/dashboard2/src/components/HeaderRight/HeaderRight.tsx | Header right content (lang selector + user dropdown/logout). |
| src/dashboard2/src/components/HeaderRight/HeaderRight.less | HeaderRight styling. |
| src/dashboard2/src/components/CustomizedSelectLang/CustomizedSelectLang.tsx | Custom language selector wrapper. |
| src/dashboard2/src/components/CustomizedSelectLang/CustomizedSelectLang.less | Language selector styling. |
| src/dashboard2/src/assets/.gitkeep | Keeps assets directory in VCS. |
| src/dashboard2/src/app.tsx | Runtime layout/theme config + request interceptors. |
| src/dashboard2/README.md | Basic readme for the new dashboard. |
| src/dashboard2/package.json | Dashboard2 dependencies and scripts. |
| src/dashboard2/.yarnrc.yml | Yarn settings for the new project. |
| src/dashboard2/.umirc.ts | Umi Max configuration and routes. |
| src/dashboard2/.stylelintrc.js | Stylelint config (Umi Max preset). |
| src/dashboard2/.prettierrc | Prettier config. |
| src/dashboard2/.prettierignore | Prettier ignore rules. |
| src/dashboard2/.npmrc | NPM registry config. |
| src/dashboard2/.lintstagedrc | Pre-commit formatting/lint config. |
| src/dashboard2/.gitignore | Dashboard2 build/artifact ignores. |
| src/dashboard2/.eslintrc.js | ESLint config (Umi Max preset). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+12
| return request<API.Result<AuthAPI.Token>>( | ||
| 'api/v1/login', | ||
| { |
Comment on lines
+30
to
+32
| return request<API.Result<AuthAPI.Token>>( | ||
| 'api/v1/register', | ||
| { |
| }, | ||
| options?: { [key: string]: any }, | ||
| ) { | ||
| return request<API.Result<OrganizationAPI.Info[]>>( |
| }, | ||
| options?: { [key: string]: any }, | ||
| ) { | ||
| return request<API.Result<NodeAPI.Info[]>>( |
| body?: NodeAPI.CreationPayload, | ||
| options?: { [key: string]: any }, | ||
| ) { | ||
| return request<API.Result<void>>('/api/v1/nodes', { |
Comment on lines
+8
to
+17
| const intl = useIntl(); | ||
| let content = ''; | ||
| if (location.pathname != '/login') { | ||
| const { data, loading, error } = useRequest(quereyUserProfile); | ||
| if (loading) { | ||
| content = 'loading...' | ||
| } else if (data) { | ||
| content = data.email; | ||
| } | ||
| } |
Comment on lines
+141
to
+142
| const status = error.response.status; | ||
| if (status > 499) { |
Comment on lines
+26
to
+30
| const { useToken } = theme; | ||
|
|
||
| export const layout = () => { | ||
| const { token } = useToken(); | ||
| return { |
Comment on lines
+140
to
+145
| Modal.error({ | ||
| className: 'token-expired-modal', | ||
| title: '登入已過期', | ||
| content: '您的登入狀態已過期,請重新登入。', | ||
| okText: '重新登入', | ||
| onOk: () => { |
Comment on lines
+84
to
+90
| request={async () => { | ||
| const res = await queryChannelList({page: 1, per_page: 10}).then(r => r.data.data); | ||
| return res.map((item: any) => ({ | ||
| label: item.name, | ||
| value: item.id, | ||
| })); | ||
| }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #773.